<?php
/* @var $this UserController */
/* @var $model User */

$this->breadcrumbs=array(
	Yii::t('app', 'Users')=>array('index'),
	Yii::t('app', 'Manage'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-form form').submit(function(){
	$('#user-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="page-header">
	<div class="page-title"><h3><?php echo Yii::t('app', 'Members Advanced Search' ) ?></h3></div>
</div>

<h1></h1>

<div class="search-form">
<?php $this->renderPartial('find/_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $dataProvider = $model->search() ?>
<table class="table table-striped table-condensed table-nobor" id="tabSum">
	<tr>
		<td><?php echo Yii::t('app', 'Number of registered user' ) ?>:</td>
		<td><?php echo $dataProvider->itemCount ?></td>
	</tr>
</table>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'dataProvider'=>$dataProvider,
	'columns'=>array(
		// actions
		array(
			// 'header'=>Yii::t('app', 'Actions'),
			'class'=>'CButtonColumn',
			'updateButtonImageUrl'=>false,
			'updateButtonLabel'=>Yii::t('app', 'View Detail'),
			'updateButtonOptions'=>array('class'=>'btn btn-info'),
			'template'=>'{update}',
			'headerHtmlOptions'=>array('class'=>'span2'),
		),
		array(
			'header' => Yii::t('app', 'No.'),
			'type' => 'raw',
			'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
			'headerHtmlOptions' => array('width' => '30px','style' => 'text-align:center;'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'nickname',
		'profile_id',
		'last_login_time:time',
		array(
			'name' => 'receive_push',
			'value' => '$data->receive_push',
			'type'=>'boolean',
			'htmlOptions' => array('style' => 'text-align:center;'),
			'headerHtmlOptions' => array('style' => 'width:100px;'),
		),
		'point',
		'created_time:time',
	),
	'itemsCssClass'=>'table table-bordered table-hover',
	'cssFile'=>false,
	'afterAjaxUpdate' => 'updateSummary',
)); ?>

<script>
function updateSummary(id,data) {
	$('#tabSum').html($(data).find('#tabSum').html());
}
</script>